package com.zzzzzz.core.controller;

import java.text.SimpleDateFormat;

import javax.annotation.Resource;

import com.zzzzzz.app.account.service.NoPermitException;
import com.zzzzzz.app.account.service.UserManager;

public class BaseController {
	
	@Resource
	protected UserManager userManager;
	
	protected boolean isSignedIn(){
		return userManager.isSignedIn();
	}
	
	protected void validCurrentUser(Long userId){
		if(!userManager.isCurrentUser(userId)){
			throw new NoPermitException();
		}
	}

	public SimpleDateFormat format = new SimpleDateFormat("MMM dd, yyyy 'at' hh:mm a");
}
